<?php

namespace App\Http\Service;

/**
 * 对融云用户的操作
 * Class User
 * @package App\Http\Service
 */
class User{
    protected $common;
    public function __construct()
    {
        $this->common = new Common;
    }

    /**
     * 用户禁言查询
     * @param $chatroomId    聊天室 Id。（必传）
     * @return mixed
     * @url https://docs.rongcloud.cn/im/server/chatroom/user_gag/
     */
    public function forbidQuery($chatroomId){
        return $this->common->curl("/chatroom/user/gag/list",array('chatroomId'=>$chatroomId));
    }

    /**
     * 用户禁言
     * @param $chatroomId    聊天室 Id。（必传）
     * @param $userId        用户 Id，可同时禁言多个用户，最多不超过 20 个。（必传）
     * @param $minute        禁言时长，以分钟为单位，最大值为43200分钟。（必传）
     * @return mixed
     * @url https://docs.rongcloud.cn/im/server/chatroom/user_gag/
     */
    public function forbidUser($chatroomId,$userId,$minute){
        return $this->common->curl("/chatroom/user/gag/add",array('chatroomId'=>$chatroomId,'userId'=>$userId,'minute'=>$minute));
    }

    /**
     * 用户禁言移除
     * @param $chatroomId    聊天室 Id。（必传）
     * @param $userId        用户 Id，可同时禁言多个用户，最多不超过 20 个。（必传）
     * @return mixed
     * @url https://docs.rongcloud.cn/im/server/chatroom/user_gag/
     */
    public function forbidUserBack($chatroomId,$userId){
        return $this->common->curl("/chatroom/user/gag/rollback",array('chatroomId'=>$chatroomId,'userId'=>$userId));
    }
}

